import java.util.concurrent.*;

/**
 * @Author kalista
 * @Description
 * @Date 2020/11/21  18:51
 **/
public class TestCall implements Callable<Integer> {

    @Override
    public Integer call() throws Exception {
        int a = 0;
        for (int i = 0; i < 100; i++) {
            a+=i;
        }
        return a;
    }


    public static void main(String[] args) throws ExecutionException, InterruptedException {

        ExecutorService executorService = Executors.newCachedThreadPool();

        TestCall testCall = new TestCall();

        Future<Integer> submit = executorService.submit(testCall);



        Integer integer = submit.get();

        System.out.println(integer);
    }
}
